#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ui->rb_red->setChecked(true);  //设置默认选中
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_rb_red_clicked()
{
    //检测复选是否选中
    if(ui->cb_up->isChecked()){
        ui->label_up->setStyleSheet("background-color:#ff0000");
    }
    if(ui->cb_down->isChecked()){
        ui->label_down->setStyleSheet("background-color:#ff0000");
    }
}

void MainWindow::on_rb_green_clicked()
{
    if(ui->cb_up->isChecked()){
        ui->label_up->setStyleSheet("background-color:#00ff00");
    }
    if(ui->cb_down->isChecked()){
        ui->label_down->setStyleSheet("background-color:#00ff00");
    }
}

void MainWindow::on_cb_up_clicked(bool checked)
{
    if(checked){
        if(ui->rb_red->isChecked()){
            ui->label_up->setStyleSheet("background-color:#ff0000");
        }else{
            ui->label_up->setStyleSheet("background-color:#00ff00");
        }
    }
}
